/**
 * 快捷支付认证交易（异步接口）
 *
 * @author xiezz
 * @version 1.1.2
 */
package com.pay.sdk.service.np;

import java.util.Map;

import com.pay.sdk.common.Configure;
import com.pay.sdk.service.IRedirectService;
import com.pay.sdk.util.MD5Utils;


public class NpPay extends IRedirectService {
    private static final String SERVICE_NAME = "api.zs.prePay";
    private static final String SERVICE_VERSION = "1.0";
    private static final String SERVICE_CHARSET = "UTF-8";
    private static final String SERVICE_SIGN_TYPE = "MD5";

    public String build(Map<String, String> params) {
      //通用参数
        params.put("version", SERVICE_VERSION);
        params.put("charset", SERVICE_CHARSET);
        params.put("sign_type",SERVICE_SIGN_TYPE);
        //请求参数
        params.put("service", SERVICE_NAME);
        params.put("merchant_no", Configure.getMerchantNo());
        params.put("out_trade_no", params.get("out_trade_no"));
        params.put("total_fee", params.get("total_fee"));
        params.put("body", params.get("body"));
		params.put("notify_url",params.get("notify_url"));
		params.put("card_type",params.get("card_type"));
		params.put("client_ip",params.get("client_ip"));
		params.put("user_id",params.get("user_id"));
		params.put("mobile",params.get("mobile"));
		params.put("time_expire", params.get("time_expire"));
		params.put("return_url", params.get("return_url"));
		params.put("attach", params.get("attach"));
		params.put("lon", params.get("lon"));
		params.put("lat", params.get("lat"));
		params = MD5Utils.signMap(params, SERVICE_SIGN_TYPE, Configure.getKey(), SERVICE_CHARSET);
        return buildRedirectFullPage(Configure.isDevEnv() ? Configure.PAY_GATEWAY_DEV_API : Configure.PAY_GATEWAY_API, params);
    }
}
